package com.soft.javase.day09.card;

/**
 * @author yzg
 * @desc TODO
 * @date 2025/4/29
 */
public class Card implements Comparable<Card> {
    private String color;
    private String number;
    private int index;

    public Card(String color, String number, int index) {
        this.color = color;
        this.number = number;
        this.index = index;
    }

    public String getColor() {
        return color;
    }

    public String getNumber() {
        return number;
    }

    public int getIndex() {
        return index;
    }

    @Override
    public String toString() {
        if (number.equals("小王") || number.equals("大王")) {
            return number;
        }
        return color + number;
    }

    @Override
    public int compareTo(Card other) {
        return other.index - index;
    }
}
